#ifndef VECTOR_H
#define VECTOR_H
//This is from the modified verison of 453 class used for modelling
//Define ourselves a basic 3D point/vector class
//***************************************************************
//
// Created BY: JESSE SAHOTA
// SID: 00325138
// ASSIGNMENT: 1
// COURSE: CPSC 589 001
//
//***************************************************************
#include<iostream>
#include<fstream>
#include<cmath>
//Just a little bit of cross platform support
#ifdef __APPLE__
#include <OpenGL/glu.h>
#else
#include <GL/glu.h>
#endif
using namespace std;

class Vector{
   friend ofstream& operator <<(ofstream& output, const Vector& p)
    {
        output << p.x << " " << p.y << " " << p.z << " ";
        return output;
    }

    friend ifstream& operator >>(ifstream& input, Vector& p)
    {
        input >> p.x >> p.y >> p.z;
        return input;
    }
	
    public:
	//Constructors
	Vector(): x(0), y(0), z(0){}
	Vector(const double & _x, const double & _y,const double & _z) :x(_x), y(_y), z(_z){}
        //Copy Constructor
        //Vector(const Vector & v){this->operator =(v);}

	~Vector();

	// Math Operators
        Vector operator +(const Vector & a) const;
        Vector operator -(const Vector & a) const;
        Vector operator -()const;
        Vector operator /(const double & s) const;
        void operator +=(const Vector & a);
        void operator =(const Vector & a);


        const double & X() const { return x; }
        const double & Y() const { return y; }
        const double & Z() const { return z; }

        double getX() const;
        double getY() const;
        double getZ() const ;
        void setX(const double & _x);
        void setY(const double & _y);
        void setZ(const double & _z);


        Vector cross(const Vector & v);
        double length()const;

        double dotProduct(const Vector & u)const;

        Vector normalize() const;
        void unit();

        double getDistance(const Vector & P)const;
        void glv();
    private:
	double x,y,z;
};

Vector operator *(const double & s, const Vector & A);
Vector operator *(const Vector & A,const double & s);
typedef Vector Point3d;

#endif
